import { Configuration, ConnectionApi, SftpApi,ShellApi,PortforwardApi } from "@linksaas-minapp/ssh-proxy-api";

export function getConnectionApi(): ConnectionApi {
    return new ConnectionApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.sshProxyAddr,
    }));
}

export function getSftpApi(): SftpApi {
    return new SftpApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.sshProxyAddr,
    }));
}

export function getShellApi(): ShellApi {
    return new ShellApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.sshProxyAddr,
    }));
}

export function getPortforwardApi(): PortforwardApi {
    return new PortforwardApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.sshProxyAddr,
    }));
}

export function getToken(): string {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    return (window as any).minApp.sshProxyToken ?? "";
}
